import { defineStore } from 'pinia'
import { ref, computed } from 'vue'

export const useAppStore = defineStore('app', () => {
  const loading = ref(false)
  const appMode = ref(import.meta.env.VITE_APP_MODE || 'development')
  const apiBase = ref(import.meta.env.VITE_API_BASE || '/api')
  
  // 计算属性
  const isDev = computed(() => appMode.value === 'development')
  
  // 方法
  function setLoading(status: boolean) {
    loading.value = status
  }
  
  return {
    loading,
    appMode,
    apiBase,
    isDev,
    setLoading
  }
})